#
# Docker image to build Android OS codes
#
FROM ubuntu:14.04

MAINTAINER Jimmy Yan <yanqinming@gmail.com>

# /bin/sh points to Dash by default, reconfigure to use bash until Android
# build becomes POSIX compliant
# RUN echo "dash dash/sh boolean false" | debconf-set-selections && \
#     dpkg-reconfigure -p critical dash

COPY sources.list /etc/apt/sources.list
COPY repo /usr/bin/repo

RUN DEBIAN_FRONTEND=noninteractive \
	&& apt-get clean && apt-get update \
	&& apt-get install -y software-properties-common \
	&& add-apt-repository ppa:deadsnakes/ppa \
	&& add-apt-repository ppa:openjdk-r/ppa \
	&& apt-get clean && apt-get update


# 配置系统语言环境和时区
# RUN DEBIAN_FRONTEND=noninteractive \
# 	&& apt-get install -y language-pack-zh-hant language-pack-zh-hans
# ENV LANG=zh_CN.UTF-8 LANGUAGE=zh_CN:zh
# RUN DEBIAN_FRONTEND=noninteractive \
#         && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
# 	&& echo 'Asia/Shanghai' >/etc/timezone

# 添加64位系统对32位支持
# RUN DEBIAN_FRONTEND=noninteractive \
	# && dpkg --add-architecture i386 && apt-get update
        # && apt-get install -y lib32z1 lib32ncurses5 lib32bz2-1.0

# 安装源码所需编译工具
# Reference: https://source.android.com/setup/build/initializing#installing-required-packages-ubuntu-1404
RUN DEBIAN_FRONTEND=noninteractive \
        && apt-get install -y openjdk-7-jdk openjdk-8-jdk openjdk-11-jdk \
		git-core gnupg flex bison gperf build-essential zip curl \
		zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
		libncurses5 lib32ncurses5-dev x11proto-core-dev libx11-dev \
		lib32z-dev libgl1-mesa-dev libxml2-utils xsltproc unzip \
		vim libswitch-perl libssl-dev python python3.6 python-dev python-pip bsdmainutils bc \
	&& pip install -i http://mirrors.aliyun.com/pypi/simple/ pycrypto \
	&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# android-sdk-platform-tools-common

CMD ["/bin/bash", "-c"]
